define(function (require, exports) {
	/**
	 * 页面加载完成时触发
	 * @param hashCode 路由ID
	 * @param data 传递数据对象
	 * @param cite 页面站点信息
	 */
	exports.ready = function (hashCode, data, cite) {
		yufp.lookup.reg('USE_MSG_VIEW_STATUS');
		yufp.custom.vue({
			el: cite.el,
			data: function () {
				return {
					searchFormdata: {},
					dataUrl: '/api/use/monitor/useMsgNotice/queryMsgNoticeListWithPage',
					formdata: {},
					dialogVisible: false,
				};
			},
			methods: {

				closeWindowFn: function () {
					this.$refs.refTable.remoteData({ condition: this.searchFormdata });
				},

				batchView: function () {
					var _this = this;

					if (_this.$refs.refTable.selections.length != 1) {
						_this.$message({ message: '请先选择一条记录', type: 'warning',duration: 6000 });
						return;
					}
					var param = {};
					param.allUseMsgNotices = _this.$refs.refTable.selections;
					yufp.service.request({
						method: 'POST',
						url: "api/use/monitor/useMsgNotice/batchUpdateViewMsgNotice",
						data: param,
						callback: function (code, message, response) {
							if (response.code != 0) {
								_this.$message(response.message);
							} else {
								_this.$message("操作成功");
								_this.$refs.refTable.remoteData({ condition: _this.searchFormdata });
							}

						}
					});
				},

				viewConsoleNotice: function () {
					var _this = this;

					if (_this.$refs.refTable.selections.length != 1) {
						_this.$message({ message: '请先选择一条记录', type: 'warning',duration: 6000 });
						return;
					}

					yufp.service.request({
						method: 'POST',
						url: "api/use/monitor/useMsgNotice/updateViewMsgNotice",
						data: _this.$refs.refTable.selections[0],
						callback: function (code, message, response) {
							if (response.code != 0) {
								_this.$message(response.message);
							} else {
								_this.dialogVisible = true;
								_this.$nextTick(function () {
									/* _this.formdata.msgTitle = _this.$refs.refTable.selections[0].msgTitle;
									 _this.formdata.sendTime = _this.$refs.refTable.selections[0].sendTime;
									 _this.formdata.receiveUser = _this.$refs.refTable.selections[0].receiveUser;
									 _this.formdata.viewStatus = _this.$refs.refTable.selections[0].viewStatus;
									 _this.formdata.msgContent = _this.$refs.refTable.selections[0].msgContent;*/
									_this.formdata.msgTitle = response.data.msgTitle;
									_this.formdata.sendTime = response.data.sendTime;
									_this.formdata.receiveUser = response.data.receiveUser;
									_this.formdata.viewStatus = response.data.viewStatus;
									_this.formdata.msgContent = response.data.msgContent;
									_this.formdata.viewTime = response.data.viewTime;
								})
							}

						}
					});

				}
			}
		});
	};
});